<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //最大值和最小值
var arr = [11,55,44,23,45,77,45];
 
 arr.sort(function (a, b) {
   return a-b;
 }); 
  
 var min = arr[0];  
  console.log(min);
 var max = arr[arr.length - 1]; 
  console.log(max);
  //次小值
  for (var i = 1; i < arr.length; i++) {
     if (min > arr[i]) {
        second = min
        min = arr[i];

     }else if(arr[i]<second&&arr[i]!=min){  //更新比最小值小，比第二小值大的
        second = arr[i]
     }
  }
//找1-100中丢失的数字
//这可以通过使用n（n + 1）/ 2计算序列的总和来轻松解决
   </script>
</body>
</html>